// pages/post/post.js
var app = getApp()
let SCREEN_WIDTH = 750
let RATE = wx.getSystemInfoSync().screenHeight /wx.getSystemInfoSync().screenWidth
Page({

	/**
	 * Page initial data
	 */
	data: {
		tempFilePath:"",
	},

	/**
	 * Lifecycle function--Called when page load
	 */
	onLoad(options) {
		if (!app.getopenid() || !app.getnickavatar()) {
			wx.reLaunch({
			  url: '../index/index',
			})
		} else {
			this.getMyPost()
		}
	},
	async getMyPost() {
        wx.showLoading({
			title: '加载中',
		  })
        var url= app.globalData.BASE_URL + '/mallUserGetPost'
        var data = {
            userId: app.getopenid()
        }
        console.log(data.userId)
		let ret = await app.reqServer(url, data, 'POST')
		console.log(ret)
        if (ret && ret.errcode == 0) {
			this.setData({
				tempFilePath: ret.url
			})
		}
		wx.hideLoading()
    },
	/**
	 * Lifecycle function--Called when page is initially rendered
	 */
	onReady() {

	},

	/**
	 * Lifecycle function--Called when page show
	 */
	onShow() {

	},

	/**
	 * Lifecycle function--Called when page hide
	 */
	onHide() {

	},

	/**
	 * Lifecycle function--Called when page unload
	 */
	onUnload() {

	},

	/**
	 * Page event handler function--Called when user drop down
	 */
	onPullDownRefresh() {

	},

	/**
	 * Called when page reach bottom
	 */
	onReachBottom() {

	},

	/**
	 * Called when user click on the top right corner to share
	 */
	onShareAppMessage() {

	}
})